package com.ruoyi.project.treat.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.domain.SysPost;
import com.ruoyi.project.treat.domain.TreatPatient;
import com.ruoyi.project.treat.service.ITreatPatientService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/treat/patient")
public class TreatPatientController extends BaseController {
    @Autowired
    private ITreatPatientService patientService;

    /**
     * 获取患者列表
     */
    @PreAuthorize("@ss.hasPermi('treat:patient:list')")
    @GetMapping("/list")
    public TableDataInfo list(TreatPatient patient)
    {
        startPage();
        List<TreatPatient> list = patientService.selectPatientList(patient);
        return getDataTable(list);
    }

    /**
     * 根据身份证号获取详细信息
     */
    @PreAuthorize("@ss.hasPermi('treat:patient:query')")
    @GetMapping(value = "/{patientIdnum}")
    public AjaxResult getInfo(@PathVariable String patientIdnum)
    {
        return AjaxResult.success(patientService.selectPatientByIdnum(patientIdnum));
    }

}
